import Card from "../entity/Card";
import { ATTR_SETTING } from "../../config/constant";
export default class CardNormal {

    base: Card

    //mod+level+feature 修正后的体重
    weight: number

    //mod+level+feature 修正后的智力
    intelligence: number

    //mod+level+feature 修正后的感知 
    perception: number

    //命中
    ar: number

    //闪避
    dodge: number

    //暴击
    crit: number

    //暴击抗性
    critResist: number

    //生命
    health: number

    //活力
    vitality: number

    //速度
    speed: number

    /**
     * 
     * @param cardBase 
     */
    constructor(cardBase: Card) {
        this.base = cardBase;
        CardNormal.attrFix(this);
        CardNormal.attrFeatureFix(this);
        CardNormal.attackFix(this);
        CardNormal.attackFeatureFix(this);
    }

    /**
     * 三围初步补正
     * @param cardNormal 
     */
    private static attrFix(cardNormal: CardNormal) {
        cardNormal.weight = cardNormal.base.mod.weight + cardNormal.base.level * cardNormal.base.weightGrouth;
        cardNormal.intelligence = cardNormal.base.mod.intelligence + cardNormal.base.level * cardNormal.base.intelligenceGrouth;
        cardNormal.perception = cardNormal.base.mod.intelligence + cardNormal.base.level * cardNormal.base.perceptionGrouth;
        cardNormal.speed = cardNormal.base.mod.speed;
    }

    /**
     * TODO: @liurui
     * 三围特性补正 
     * @param cardNormal 
     */
    private static attrFeatureFix(cardNormal: CardNormal) {

    }

    /**
     * 攻防初步补正
     * @param cardNormal 
     */
    private static attackFix(cardNormal: CardNormal) {
        cardNormal.crit = ATTR_SETTING.CRIT_BASE + ATTR_SETTING.CRIT_INT_FIX * cardNormal.intelligence;
        cardNormal.critResist = ATTR_SETTING.CRIT_RES_BASE + ATTR_SETTING.CRIT_RES_INF_FIX * cardNormal.intelligence;
        cardNormal.dodge = ATTR_SETTING.DODGE_BASE + ATTR_SETTING.DODGE_PER_FIX * cardNormal.perception;
        cardNormal.ar = ATTR_SETTING.AR_BASE + ATTR_SETTING.AR_PER_FIX * cardNormal.perception;
    }

    /**
     * TODO: @liurui
     * 攻防特性补正 
     * @param cardNormal 
     */
    private static attackFeatureFix(cardNormal: CardNormal) {

    }

}
